package demo3;

import java.util.Scanner;

public class Text1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] s = in.next().toCharArray();

        StringBuilder sb = new StringBuilder();

        for(int i = 0; i < s.length; i++) {
            char ch = s[i];
            if(sb.length() != 0 && sb.charAt(sb.length()-1)==ch) {
                // 出栈
                sb.deleteCharAt(sb.length()-1);
            } else {
                // 入栈
                sb.append(ch);
            }
        }
        System.out.println(sb.length()==0?0:sb.toString());
    }
}
